#! /bin/bash
# 在本目录执行脚本
shDir=$(cd `dirname $0`; pwd)
cd ${shDir}

# 变量声明
. ../func/const.sh
. ../func/file.sh
# 桌面环境+窗口管理器（仅配置文件

## 应用程序配置所在目录
confSource="${bakConfDir}/${uzerName}"
## 选择桌面环境
echo -e '\e[34m配置桌面环境\e[0m'
echo -e '桌面环境列表：\n- xfce4\n- plasma5\n- gnome3\n- i3wm\n- dde\n- quit（默认不配置桌面环境'
read -p "${loginName}，要使用哪种桌面环境：" dewm
echo "${dewm}"

while :; do

	if [[ "${dewm}" == 'xfce4' ]]; then
	    mkFileOld "${uzerConf}" 'xfce4'
		echo 'Xfce4桌面环境配置'
	    ln -sf "${confSource}/.config/xfce4" "${uzerConf}/xfce4"
		break
	elif [[ "${dewm}" == 'i3wm' ]]; then
	    mkFileOld "${uzerConf}" 'i3'
	    echo 'i3窗口管理器配置'
	    ln -sf "${confSource}/.config/i3" "${uzerConf}/i3"
	    break
	elif [[ "${dewm}" == 'quit' ]]; then
		echo -e '\n不配置桌面环境\n'
		break
	else
		# 报错并回到主菜单
		echo -e '\n暂不支持该桌面环境\n'
		break
	fi

done

# 应用查找器
## Rofi
mkFileOld "${uzerConf}" 'rofi'
echo 'rofi配置'
ln -sf "${confSource}/.config/rofi" "${uzerConf}/rofi"

# 窗口透明支持
## picom
mkFileOld "${uzerConf}" 'picom'
echo 'picom配置'
ln -sf "${confSource}/.config/picom" "${uzerConf}/picom"
## compton暂无配置

# 按键绑定
## xbindkeys
mkFileOld "${homeDir}/.xbindkeysrc"
echo 'xbindkeys配置'
ln -sf "${confSource}/.xbindkeysrc" "${homeDir}/.xbindkeysrc"

# vnc配置
mkFileOld "${homeDir}/.vnc"
echo 'vnc配置'
ln -sf "${bakConfDir}/vnc" "${homeDir}/.vnc"